import axios from 'axios';
axios.defaults.baseURL="http://101.34.221.211:8080"
const Ajax=(url,data={},type='GET')=>{
    return new Promise((resolve,reject)=>{
        let promise;
        if(type==='GET'){
            promise=axios.get(url,{
                params:data
            })
        }
        else{
            promise=axios.post(url,{
                params:data
            })
        }
        // console.log(promise,'promise');
        promise
        .then((response)=>{
            resolve(response);
        })
        .catch((error)=>{
            console.log('数据请求异常',error);
        })

    })
}

export default Ajax